package mysql

import (
	"gorm.io/gorm"
)

type User struct {
	gorm.Model
	Mobile   string `gorm:"type:varchar(50)"`
	Password string `gorm:"type:varchar(50)"`
}

func (u *User) FindUserLoginBy(db *gorm.DB, mobile string) error {
	return db.Debug().Where("mobile = ?", mobile).Find(u).Error
}

func (u *User) UserAddBy(db *gorm.DB) interface{} {
	return db.Debug().Create(u).Error
}

func (u *User) UserShowById(db *gorm.DB, id int64) error {
	return db.Debug().Where("id = ?", id).Find(u).Error
}
